<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主要内容区main</title>
<link href="../include/css/css.css" type="text/css" rel="stylesheet" />
<link href="../include/css/main.css" type="text/css" rel="stylesheet" />
<link rel="shortcut icon" href="../include/images/main/favicon.ico" />
<style>
body{overflow-x:hidden; background:#f2f0f5; padding:15px 0px 10px 5px;}
#searchmain{ font-size:12px;}
#search{ font-size:12px; background:#548fc9; margin:10px 10px 0 0; display:inline; width:100%; color:#FFF; float:left}
#search form span{height:40px; line-height:40px; padding:0 0px 0 10px; float:left;}
#search form input.text-word{height:24px; line-height:24px; width:180px; margin:8px 0 6px 0; padding:0 0px 0 10px; float:left; border:1px solid #FFF;}
#search form input.text-but{height:24px; line-height:24px; width:55px; background:url(../include/images/main/list_input.jpg) no-repeat left top; border:none; cursor:pointer; font-family:"Microsoft YaHei","Tahoma","Arial",'宋体'; color:#666; float:left; margin:8px 0 0 6px; display:inline;}
#search a.add{ background:url(../include/images/main/add.jpg) no-repeat -3px 7px #548fc9; padding:0 10px 0 26px; height:40px; line-height:40px; font-size:14px; font-weight:bold; color:#FFF; float:right}
#search a:hover.add{ text-decoration:underline; color:#d2e9ff;}
#main-tab{ border:1px solid #eaeaea; background:#FFF; font-size:12px;}
#main-tab th{ font-size:12px; background:url(../include/images/main/list_bg.jpg) repeat-x; height:32px; line-height:32px;}
#main-tab td{ font-size:12px; line-height:40px;}
#main-tab td a{ font-size:12px; color:#548fc9;}
#main-tab td a:hover{color:#565656; text-decoration:underline;}
.bordertop{ border-top:1px solid #ebebeb}
.borderright{ border-right:1px solid #ebebeb}
.borderbottom{ border-bottom:1px solid #ebebeb}
.borderleft{ border-left:1px solid #ebebeb}
.gray{ color:#dbdbdb;}
td.fenye{ padding:10px 0 0 0; text-align:right;}
.bggray{ background:#f9f9f9}
</style>
</head>
<body>
<!--main_top-->
<table width="99%" border="0" cellspacing="0" cellpadding="0" id="searchmain">
  <tr>
    <td width="99%" align="left" valign="top">您的位置：订单管理</td>
  </tr>
  <?php 
        //error_reporting(E_ALL & ~E_NOTICE);    
        //$_GET['typeid'] = empty($_GET['typeid']) ? '' : $_GET['typeid'];
        
        $_GET['orderid'] = empty($_GET['orderid']) ? '' : $_GET['orderid'];
        $_GET['name'] = empty($_GET['name']) ? '' : $_GET['name'];
        $wherelist = array();
        $where = '';
        $urllist = array();
        $url = '';
        
    ?>
  <tr>
    <td align="left" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="search">
  		<tr>
   		 <td width="90%" align="left" valign="middle">
	         <!--<form action="index.php">
                <span>订单ID号:</span>
                <input type="text" name="orderid" value="<?php echo $_GET['orderid']; ?>" size='3' class="text-word">
                <span>商品名:</span>
                <input type="text" name="name" value="<?php echo $_GET['name']; ?>" size='3' class="text-word">
                <input type="submit" value="查询" class="text-but">
               
	         </form>-->
         </td>
  		  <td width="10%" align="center" valign="middle" style="text-align:right; width:150px;"><a href="add.php" target="mainFrame" onFocus="this.blur()" class="add">浏览订单</a></td>
  		</tr>
	</table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="main-tab">
      <tr>
        <th align="center" valign="middle" class="borderright">订单ID号</th>
        <th align="center" valign="middle" class="borderright">订单总额</th>
        <th align="center" valign="middle" class="borderright">收货人</th>
        <th align="center" valign="middle" class="borderright">商品ID号</th>
        <th align="center" valign="middle" class="borderright">商品</th>
        <th align="center" valign="middle" class="borderright">商品名称</th>
        <th align="center" valign="middle" class="borderright">单价</th>
        <th align="center" valign="middle" class="borderright">数量</th>
        <th align="center" valign="middle" class="borderright">状态</th>
      </tr>
     <?php
			//六脉神剑	
            
			//六脉神剑	
			include("../../public/dbconfig.php");
			$link = @mysqli_connect(HOST,USER,PASS,DBNAME) or die("数据库连接失败");
			mysqli_set_charset($link,"utf8");
			$orderid = $_GET['id'];
            // echo $orderid;die;
            $sql = "select d.*,o.linkman,o.total,o.status from detail d,orders o where d.orderid=o.id and orderid={$orderid} ";
            $result1 = mysqli_query($link,$sql);
            //封装搜索条件
            
            //实现分页
            //设置参数
            $page = empty($_GET['page']) ? 1 : $_GET['page'];
            $maxRow = 0;//共多少条
            $pageSize = 4;//页大小
            $maxPage = 0;//共多少页
            $maxRow = mysqli_num_rows($result1);
            //echo $maxRow;
            
            $maxPage = ceil($maxRow/$pageSize);
            
            if($page>$maxPage){
                $page = $maxPage;
            }
            if($page<1){
                $page = 1;
            }
            $limit = " limit ".($page-1)*$pageSize.",".$pageSize;
            
            // echo $sql;
            //实现分页
            $sql = "select d.*,o.linkman,o.total,o.status from detail d,orders o where d.orderid=o.id and orderid={$orderid} ".$limit;
            // echo $sql;die;
			$result = mysqli_query($link,$sql);
            $status = array("1"=>"新订单","2"=>"已发货","3"=>"已收货");
			while($row = mysqli_fetch_assoc($result)){
                
            
$str = <<<aa
        <tr class="bggray" onMouseOut="this.style.backgroundColor='#f9f9f9'" onMouseOver="this.style.backgroundColor='#edf5ff'">
        <td align="center" valign="middle" class="borderright borderbottom">{$row['orderid']}</td>
        <td align="center" valign="middle" class="borderright borderbottom">{$row['total']}</td>
        <td align="center" valign="middle" class="borderright borderbottom">{$row['linkman']}</td>
        <td align="center" valign="middle" class="borderright borderbottom">{$row['goodid']}</td>
        <td align="center" valign="middle" class="borderright borderbottom">{$row['name']}</td>
        <td align="center" valign="middle" class="borderright borderbottom"><a href='../../public/uploads/{$row['picname']}' target='_blank'><img src='../../public/uploads/s_{$row['picname']}' /></a></td>
        <td align="center" valign="middle" class="borderright borderbottom">{$row['price']}</td>
        <td align="center" valign="middle" class="borderright borderbottom">{$row['num']}</td>
        <td align="center" valign="middle" class="borderright borderbottom">{$status[$row['status']]}</td>
      </tr>
aa;
        echo $str;
            }
?>
      
    </table></td>
    </tr>
  <tr>
    <td align="left" valign="top" class="fenye"><?php echo mysqli_num_rows($result1);?>条数据<?php echo $page;?>/<?php echo $maxPage;?>页&nbsp;&nbsp;
    <a href="index1.php?page=1<?php echo $url;?>" target="mainFrame" onFocus="this.blur()">首页</a>&nbsp;&nbsp;
    <a href="index1.php?page=<?php echo ($page-1),$url; ?>" target="mainFrame" onFocus="this.blur()">上一页</a>&nbsp;&nbsp;
    <a href="index1.php?page=<?php echo ($page+1),$url; ?>" target="mainFrame" onFocus="this.blur()">下一页</a>&nbsp;&nbsp;
    <a href="index1.php?page=<?php echo $maxPage,$url; ?>" target="mainFrame" onFocus="this.blur()">尾页</a></td>
  </tr>
    <?php
        mysqli_close($link);
		mysqli_free_result($result1);
		mysqli_free_result($result);
    ?>
</table>
</body>
</html>